<?php
error_reporting(0);
$isadmin=1;    
include '../../comm/config.php';
include '../check.php';
include('../../comm/class_db.php');
include_once '../include/page.class.php';

$page = !($_GET['page'])?'1':intval($_GET['page']);
$pagesize=10;
$page2=($page-1)*$pagesize;

$keyword=trim($_GET['keyword']);
$qr=$_GET['qr'];
if($qr!=""){
	if($qr=="未确认"){
		$subsql=" and u_id=0";
	}else{
		$subsql=" and stat_desc='".$qr."'";
	}
}
$total=sql_count("mall_order","id",1,1," and `order_code` like '%".$keyword."%' ".$subsql."");
$sql="select * from ".$BIAOTOU."mall_order where `order_code` like '%".$keyword."%' ".$subsql."  order by order_time desc limit $page2,$pagesize";
$rs = mysql_query($sql);
mysql_close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
-->
</style>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td width="" height="30" align="left" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 交易管理 [ <a href="mallgetorders.php" class="link3">获取订单<span style="font-size:11px; color:#333">(领克特)</span></a> ]  [ <a href="mallgetyiqifa.php" class="link3">获取订单<span style="font-size:11px; color:#333">(一起发)</span></a> ] <!--[ <a href="mallgetchanet.php" class="link3">获取订单<span style="font-size:11px; color:#333">(成果)</span></a> ] -->[ <a href="mallgetduomai.php" class="link3">获取订单<span style="font-size:11px; color:#333">(多麦)</span></a> ] </strong></td>
              <form id="form1" name="form1" method="get" action="">
              <input type="hidden" name="action" value="mallorders"  />
              <td width="330" align="left" bgcolor="E9F2FB" class="bigtext">订单号
                  <input type="text" class="button3" name="keyword" />
                  <select name="qr">
                    <option value="">全部</option>
                    <option value="核对有效" <?php if ($qr=="核对有效") echo "selected";?>>核对有效</option>
                    <option value="未核对" <?php if ($qr=="未核对") echo "selected";?>>未核对</option>
					<option value="未确认" <?php if ($qr=="未确认") echo "selected";?>>未确认</option>
                  </select>
                  <input type="submit" name="Submit" value="查找" />
                </td></form>
              <td width="80" height="30" align="right" bgcolor="E9F2FB" class="bigtext">共有 <b><?php echo $total;?></b> 条</td>
            </tr>
            <tr>
              <td colspan="3" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><table width="100%" border=1 cellpadding=0 cellspacing=0
style="border-collapse: collapse" bordercolor="#dddddd">
                    <tr>
                      <td width="12%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>下单时间</strong></td>
                      <td width="8%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>所属商城</strong></td>
                      <td width="7%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>所属联盟</strong></td>
                      <td width="10%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>会员</strong></td>
					  <td width="6%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>数量(件)</strong></td>
                      <td width="6%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>单价(元)</strong></td>
                      <td width="8%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>销售值(元)</strong></td>                      
                      <td width="7%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>佣金(元)</strong></td>
                      <td width="7%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>返现(元)</strong></td>
                      <td width="13%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>订单号</strong></td>
                      <td width="7%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>状态</strong></td>
                      <td width="9%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>执行操作</strong></td>
                    </tr>
                    <?php
					while ($row = mysql_fetch_array($rs))
					{
						echo "<tr>";
                      	echo "<td height=30 align=\"center\" class=bigtext>".date("Y-m-d",strtotime($row["order_time"]))."</td>";
                      	echo "<td height=30 align=\"center\" class=bigtext>".$row["merchant_id"]."</td>";
						echo "<td height=30 align=\"center\" class=bigtext>".$row["lm"]."</td>";
						echo "<td align=\"center\" class=bigtext>".$row["ddusername"]."</td>";
						echo "<td align=\"center\" class=bigtext>".$row["item_count"]."</td>";
						echo "<td align=\"center\" class=bigtext>".$row["item_price"]."</td>";
						echo "<td align=\"center\" class=bigtext>".$row["sales"]."</td>";
						echo "<td align=\"center\" class=bigtext>".$row["commission"]."</td>";
						echo "<td align=\"center\" class=bigtext>".$row["fxje"]."</td>";
						echo "<td align=\"center\" class=bigtext>".$row["order_code"]."</td>";
						echo "<td align=\"center\" class=bigtext>".$row["stat_desc"]."</td>";
						echo "<td align=\"center\" class=bigtext><a href=\"mall_queren.php?id=".$row["id"]."\" class=link4>确认</a> <a href=mallorderdel.php?id=".$row["id"]." class=link4 onclick='return confirm(\"确定要删除?\")'>删除</a></td>";
						echo "</tr>";
					}
					?>
                    <tr>
                      <td height="43" colspan="12" align="center"><div class="yahoo2" style=" margin-top:30px;"><?php 
				pageft($total,$pagesize,1,1,0,10,"mallorders.php?keyword=".urlencode($keyword).'&qr='.urlencode($_GET['qr']));
				echo $pagenav;?></div></td>
                    </tr>
                  </table></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>